/**
 * Copyright (c) 2019 xstgongyi.org
 * All rights reserved.
 */
package org.xstgongyi.eduaid.common;

/**
 * Generic business exception. Create sub exception if necessary.
 *
 * Rationale 1: we prefer to use generic Exception, not concrete Exception per
 * case. Error code could be used to distinguish different cases.
 *
 * Rationale 2: business Exception is about business logic. Non-business
 * exception, such I/O, should not be wrapped by business exception.
 * 
 * @author oldcrane<br/>
 * @created 2019-04-15
 */
public class BusinessException extends Exception {
	private static final long serialVersionUID = 1L;

	private int errorCode;
	private String errorMessage;

	public BusinessException(int errorCode) {
		this(errorCode, null);
	}

	public BusinessException(int errorCode, String errorMessage) {
		super(errorMessage);
		this.errorCode = errorCode;
		this.errorMessage = errorMessage;
	}

	public int getErrorCode() {
		return errorCode;
	}

	public String getErrorMessage() {
		return errorMessage;
	}

}
